package controller

import (
	"git.mycaigou.com/gfyx/micro-gfyx-bigdata-service/infrastructure/dto"
	contract2 "git.mycaigou.com/gfyx/micro-gfyx-bigdata-service/service/bigdata/contract"
	"github.com/gin-gonic/gin"
)

// 商机控制器，负责招标、项目相关数据
type OpptyController struct {
	BaseController
	opptyService contract2.OpptyServiceIface
}

func NewOpptyController(
	opptyService contract2.OpptyServiceIface,
) *OpptyController {
	return &OpptyController{
		opptyService: opptyService,
	}
}

func (w *OpptyController) RegisterRouter(g *gin.RouterGroup) {
	g.GET("/bid-detail-content", w.getBidDetailContent)
}

// getBidDetail 获取招标详情
func (w *OpptyController) getBidDetailContent(ctx *gin.Context) {
	request := &dto.GetBidDetailContentRequest{}
	if err := ctx.ShouldBindQuery(&request); err != nil {
		w.Fail(ctx, -1, err.Error())
		return
	}

	result, err := w.opptyService.GetBidDetailContent(ctx, request)
	if err != nil {
		w.Fail(ctx, -1, err.Error())
		return
	}
	w.Success(ctx, map[string]interface{}{"content": result})
	//w.Success(ctx, map[string]interface{}{})
}
